import request from '@/router/axios'

// 分页列表
export const list = (data) => {
  return request({
    url: '/backend/appModel/getPage',
    method: 'post',
    data
  })
}

// 排序功能的权限判断
export const sortAuth = (data) => {
  return request({
    url: '/backend/appModel/getPermissions',
    method: 'post',
    data
  })
}

// 详情
export const detail = (params) => {
  return request({
    url: '/backend/appModel/getById',
    method: 'post',
    params
  })
}

// 新增/编辑
export const edit = (data) => {
  return request({
    url: '/backend/appModel/edit',
    method: 'post',
    data
  })
}

// 启用/停用
export const enable = (params) => {
  return request({
    url: '/backend/appModel/enable',
    method: 'post',
    params
  })
}

// 获取应用
export const app = () => {
  return request({
    url: '/access/app',
    method: 'post'
  })
}

// 获取应用集
export const appSet = () => {
  return request({
    url: '/access/appSet',
    method: 'post'
  })
}

// 获取业务体系
export const getBusinessSystem = (params) => {
  return request({
    url: '/access/getBusinessSystem',
    method: 'post',
    params
  })
}

// 获取排序列表
export const sortList = (data) => {
  return request({
    url: '/backend/appModel/getSortList',
    method: 'post',
    data
  })
}

// 获取排序列表
export const sort = (data) => {
  return request({
    url: '/backend/appModel/sort',
    method: 'post',
    data
  })
}

// /根据所属应用id获取业务体系
export const getAppByAppSet = (params) => {
  return request({
    url: '/backend/appModel/getAppByAppSet',
    method: 'post',
    params
  })
}

// /根据所属应用id获取业务体系
export const getBusinessSystemByApp = (params) => {
  return request({
    url: 'backend/appModel/getBusinessSystemByApp',
    method: 'post',
    params
  })
}

// 文件上传
export const upload = (FormData) => {
  return request({
    url: '/file/upload',
    method: 'post',
    data: FormData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
